﻿<cms-page-body ng-if="vm.isSetupComplete">
    <cms-form-section cms-title="Setup complete">
        <p>You're all set to go. Please follow the link below to sign in to Cofoundry.</p>
        <div class="actions">
            <a class="btn main-cta" href="{{::vm.urlLibrary.login()}}">Login</a>
        </div>
    </cms-form-section>
</cms-page-body>

<cms-form cms-name="mainForm"
          cms-edit-mode="true"
          ng-if="!vm.isSetupComplete"
          ng-submit="vm.save()">

    <cms-page-body cms-content-type="form-basic">

        <cms-form-status></cms-form-status>

        <cms-form-section cms-title="Site setup">

            <p>Before we get started, we're gonna need some basic setup information from you. This will give your application a name and also create the default user account.</p>

            <cms-form-field-text cms-title="Application Name"
                cms-model="vm.command.applicationName"
                maxlength="100"
                required
                placeholder="e.g. My Application"
                cms-description="A name to describe your application, up to 100 characters."></cms-form-field-text>

            <cms-form-field-sub-heading>Default User Account</cms-form-field-sub-heading>

            <cms-form-field-text cms-title="Name"
                cms-model="vm.command.displayName"
                maxlength="150"
                placeholder="e.g. Example User"
                cms-description="A display name for the default user account, can be up to 150 characters."></cms-form-field-text>

            <cms-form-field-email-address cms-title="Email"
                cms-model="vm.command.email"
                maxlength="150"
                required
                placeholder="e.g. user@example.com"
                cms-description="An email address to use as the username for the default account and to send account recovery notifications to."></cms-form-field-email-address>

            <cms-form-field-password cms-title="Password"
                cms-model="vm.command.password"
                cms-password-policy="vm.passwordPolicy"
                required></cms-form-field-password>

            <cms-form-field-password cms-title="Confirm password"
                cms-model="vm.command.confirmPassword"
                cms-match="vm.command.password"
                cms-match-val-msg="Passwords must match"
                maxlength="2048"
                required></cms-form-field-password>
            
            <div class="actions">
                <cms-button-submit cms-text="Save"
                    ng-disabled="vm.mainForm.$invalid || vm.saveLoadState.isLoading"
                    cms-loading="vm.saveLoadState.isLoading"></cms-button-submit>
            </div>
        </cms-form-section>
        
    </cms-page-body>

</cms-form>